home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C++ / Libraries / RgnMaster 1.0 / Source / Utils / DialogUtils.c++ < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-27  |  2.1 KB  |  77 lines  |  [TEXT/KAHL]

  1. #include "DialogUtils.h"
  2.  
  3. void PushButton(DialogPtr theDialog, short theItem) {
  4.     HiliteControl((ControlHandle)GetDItemHdl(theDialog, theItem), inButton);
  5.     Delay(7, nil);
  6.     HiliteControl((ControlHandle)GetDItemHdl(theDialog, theItem), 0);
  7. } // END PushButton
  8.  
  9. void GetDItemRect(DialogPtr theDialog, short theItem, Rect *theRect) {
  10.     Handle itemH; short itemT;
  11.     GetDItem(theDialog, theItem, &itemT, &itemH, theRect);
  12. } // END GetDItemRect
  13.  
  14. void SetDItemText(DialogPtr theDialog, short theItem, Str255 iText) {
  15.     Handle itemH; short itemT; Rect itemR;
  16.     GetDItem(theDialog, theItem, &itemT, &itemH, &itemR);
  17.     SetIText(itemH, iText);
  18. } // END SetDItemText
  19.  
  20. void SetUserProc(DialogPtr theDialog, short theItem, ProcPtr theProc) {
  21.     Handle itemH; short itemT; Rect itemR;
  22.     GetDItem(theDialog, theItem, &itemT, &itemH, &itemR);
  23.     SetDItem(theDialog, theItem, itemT, (Handle)theProc, &itemR);
  24. } // END SetUserProc;
  25.  
  26. pascal void FrameItemRect(DialogPtr theDialog, short theItem) {
  27.     Rect itemRect;
  28.     Pattern savePat;
  29.     GrafPtr savePort;
  30.  
  31.     GetPort(&savePort);
  32.     BlockMove(&theDialog->pnPat, &savePat, sizeof(Pattern));
  33.  
  34.     SetPort(theDialog);    // Important!
  35.     GetDItemRect(theDialog, theItem, &itemRect);
  36.     PenPat(black);
  37.     FrameRect(&itemRect);
  38.     PenPat(savePat);
  39.     SetPort(savePort);
  40. } // END FrameItemRect
  41.  
  42. pascal void FrameGrayRect(DialogPtr theDialog, short theItem) {
  43.     Rect itemRect;
  44.     Pattern savePat;
  45.     GrafPtr savePort;
  46.  
  47.     GetPort(&savePort);
  48.     BlockMove(&theDialog->pnPat, &savePat, sizeof(Pattern));
  49.  
  50.     SetPort(theDialog);    // Important!
  51.     GetDItemRect(theDialog, theItem, &itemRect);
  52.     PenPat(gray);
  53.     FrameRect(&itemRect);
  54.     PenPat(savePat);
  55.     SetPort(savePort);
  56. } // END FrameGrayRect
  57.  
  58. Handle GetDItemHdl(DialogPtr theDialog, short theItem) {
  59.     Handle itemH; short itemT; Rect itemR;
  60.     GetDItem(theDialog, theItem, &itemT, &itemH, &itemR);
  61.     return(itemH);
  62. } // END GetItemHdl
  63.  
  64. void OutlineDefaultButton(DialogPtr theDialog, short theItem) {
  65.     Rect buttonRect;
  66.     GrafPtr savePort;
  67.  
  68.     GetPort(&savePort);
  69.     SetPort(theDialog);
  70.     GetDItemRect(theDialog, theItem, &buttonRect);
  71.  
  72.     InsetRect(&buttonRect, -4, -4);
  73.     PenSize(3, 3);
  74.     FrameRoundRect(&buttonRect, 16, 16);
  75.     PenNormal();
  76.     SetPort(savePort);
  77. } // END OutlineDefaultButton